import { createI18n } from 'vue-i18n';
import ZH from './ZH_CN';
import EN from './EN';

const locale = uni.getStorageSync('lang') === 'en' ? 'en' : 'zh';
const fallbackLocale = uni.getStorageSync('lang') === 'en' ? 'en' : 'zh';

const i18n = createI18n({
  legacy: false,
  locale,
  fallbackLocale,
  globalInjection: true,
  messages: {
    zh: ZH,
    en: EN,
  },
});

export default i18n;
